package mo.offer_version2;

public class L66 {

    public int[] constructArr(int[] a) {
        int length = a.length;
        int[] res = new int[length];
        res[0] = 1;
        for (int i = 1; i < length; i++) {
            res[i] = res[i-1] * a[i-1];
        }
        int R = 1;
        for (int i = length - 1; i >= 0; i--) {
            res[i] = res[i] * R;
            R = R * a[i];
        }
        return res;
    }


}
